RT_SECURE_NO_WARNINGS 1
#include "Task.hpp"
#include "ThreadPool.hpp"

#include <Windows.h>
//#include <unistd.h>

int main()
{
	//prctl()
	const std::string operators = "+-*/%";
	ThreadPool<Task> tp(5);
	tp.start();
	Sleep(1000);
	//_sleep(1000);
	srand((unsigned long)time(nullptr));
	//派发任务的线程
	while (true)
	{
		int one = rand() % 50;
		int two = rand() % 10;
		char oper = operators[rand() % operators.size()];
		cout << "主线程派发计算任务: " << one << oper << two << "=?" << endl;
		Task t(one, two, oper);
		tp.push(t);
		Sleep(1000);
	}
	return 0;
}

